package com.cn.wanxi.servlet;

import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.ICommonService;
import com.cn.wanxi.service.IHomeService;
import com.cn.wanxi.service.IProductService;
import com.cn.wanxi.service.impl.CommonServiceImpl;
import com.cn.wanxi.service.impl.HomeServiceImpl;
import com.cn.wanxi.service.impl.ProductServiceImpl;
import net.sf.json.JSONArray;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/product")
public class ProductServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        ICommonService iCommonService = new CommonServiceImpl();
//        req.setAttribute("commonModelDto", iCommonService.getCommonModelDto());
//
//        IProductService iProductService = new ProductServiceImpl();
//        req.setAttribute("productList", iProductService.getFindAll());
//        req.getRequestDispatcher("/jsp/product.jsp").forward(req, resp);//将值转发到页面去
        IProductService iProductService=new ProductServiceImpl();
//        ResultModel resultModel=iProductService.findByCookStyleId();

//        JSONArray jsonArray=JSONArray.fromObject(resultModel);
//        resp.getWriter().println(jsonArray);
    }
}
